<?php
require_model('base.class');
class doctorApply extends base {
    private $table = 'DoctorApply';
    private $primary = 'Id';
    function __construct() {
        parent::__construct($this->table,$this->primary);
    }
    function GetDoctorApply($username) {
        return $this->get_items(array('UserName'=>$username));
    }
    function AddApply($params) {
        if($this->insert_item($params)){
            return $this->db->insert_id();
        }else {
            return false;
        }
    }
    function GetCurrentApplyById() {
        $current_apply_id = $this->ctx->get_session('current_apply_id', true);
        return $this->get_item(array('Id'=>$current_apply_id));
    }
    function UpdateCurrentApply($update) {
        $current_apply_id = $this->ctx->get_session('current_apply_id', true);
        return $this->update_item($update, array('Id'=>$current_apply_id));
    }
    function GetDoctorApplyByUserNameAndCheckStatus($username, $check_status) {
        return $this->get_item(array('UserName'=>$username, 'CheckStatus'=>$check_status));
    }
}